package com.kye.express.business.invoice_online;

import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.kye.express.business.invoice_online.tab.InvoiceInfoCompanyFragment;
import com.kye.express.business.invoice_online.tab.InvoiceInfoPeopleFragment;
import com.kye.model.bean.invoice_online.GeneratedInvoiceDataResultBean;

import java.util.ArrayList;

public class InvoiceInfoPageAdapter extends FragmentPagerAdapter {
    private ArrayList<GeneratedInvoiceDataResultBean> mCurrentSelectedWaybillList = new ArrayList<>();
    private double mTotalPrice = 0;

    public InvoiceInfoPageAdapter(FragmentManager fm,ArrayList<GeneratedInvoiceDataResultBean> generatedInvoiceDataResultBeans, double totalPrice) {
        super(fm);
        mCurrentSelectedWaybillList = generatedInvoiceDataResultBeans;
        mTotalPrice = totalPrice;
    }

    @Override
    public Fragment getItem(int position) {
        if (position == 0) {
            return InvoiceInfoCompanyFragment.newInstance(mCurrentSelectedWaybillList,mTotalPrice);
        } else {
            return InvoiceInfoPeopleFragment.newInstance(mCurrentSelectedWaybillList,mTotalPrice);
        }
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return super.getPageTitle(position);
    }

    @Override
    public int getCount() {
        return 2;
    }
}
